<?php
namespace bee;

$download = new download();
$download->SELECT(filter_var($_REQUEST['download_id'], FILTER_VALIDATE_INT));
if($download->expire < date('Y-m-d H:i:s'))
{	denyUser();
}



if($download->client)
{	die(print_r($download, true));
  if($download->client != app::$user->id)
	{	processor::denyUser();
	}
}
if($download->group )
{	if(!isInGroup(app::$user->id, $download->group) || $download->group == -1)
	{	denyUser();
	}
}
if($download->org_id)
{	if($app_USER->org_id != $download->org_id)
	{ processor::denyUser();
	}
}
if($download->document_id)
{
}

header("Content-type: $download->content_type");
if(!isset($_REQUEST['dont_download']))
{	header('Content-Disposition: attachment; filename="' . $download->down_name . '"');
}
readfile($download->file_name);
